package edu.sctu.xialei.june.day20150605one;

import java.util.Calendar;
//import java.util.

/**
 * Created by Administrator on 6/7/2015.
 */
public class TimeCounter {


    public void count(Calendar time) {

        Calendar now = Calendar.getInstance();

        long timeLag = now.getTime().getTime() - time.getTime().getTime();

        long days = timeLag / 1000 / 60 / 60 / 24;
        long hours = (timeLag - days * 24 * 60 * 60 * 1000) / 1000 / 60 / 60;
        long minutes = (timeLag - days * 24 * 60 * 60 * 1000 - hours * 60 * 60 * 1000) / 1000 / 60;
        long seconds = (timeLag - days * 24 * 60 * 60 * 1000 - hours * 60 * 60 * 1000 - minutes * 60 * 1000) / 1000;
        long milliSeconds = timeLag - days * 24 * 60 * 60 * 1000 - hours * 60 * 60 * 1000 - minutes * 60 * 1000 - seconds * 1000;

        System.out.println("***时间：" + time.getTime() + "  距离  " + now.getTime() + "  的时间为***\n");
        System.out.println("天  小时 分钟  秒  毫秒");
        System.out.println(days + "   " + hours + "   " + minutes + "    " + seconds + "    " + milliSeconds);

    }
}
